{% extends "base_jrcadmin1.html" %}

{% block content %}

    <table>
        <tr>
            <th colspan="6">{{ f.original_name }}</th>
        </tr>
        <tr>
            <th>Entry - exit</th>
            <th>Entry date</th>
            <th>Entry price</th>
            <th>Exit date</th>
            <th>Exit price</th>
            <th>Profit/loss</th>
        </tr>
    
    {% for trading in tlist %}
        <tr class="{% cycle "row1" "row2" %}">
            <td>{{ x }} {{ trading.entry_type }} - {{ trading.exit_type }}</td>
            <td>{{ trading.entry_date }}</td>
            <td>{{ trading.entry_price }}</td>
            <td>{{ trading.exit_date }}</td>
            <td>{{ trading.exit_price }}</td>
            {% if trading.get_is_profit %}
                <td class="profit_trade">{{ trading.get_profit|floatformat:"-5" }}</td>
            {% else %}
                <td class="non_profit_trade">{{ trading.get_profit|floatformat:"-5" }}</td>
            {% endif %}
        </tr>
        
        {% if forloop.last %}
        
        <tr>
            <td colspan="6">
                <form action="/ximport/uploadfile/{{ f.pk }}/import/" method="post">
                {% csrf_token %}
                <input type="submit" value="Import and delete old" class="default" />
                </form>
            </td>
        </tr>

        
        {% endif %}
        
    {% empty %}
        <tr>
            <td colspan="6">
            No tradinglist items in CSV file!
            </td>
        </tr>
    {% endfor %}
    </table>


{% endblock %}
